<template>
  <page-scroll :footer="false">
    <template #bg>
      <div class="bg"></div>
    </template>
    <template #header>
      <gltitle
        :title="title"
        :is_name="true"
        :is_back="true"
        :is_lang="false"
        :is_kf="false"
      ></gltitle>
    </template>
    <template #content>
      <div class="container">
        <ul class="list" v-if="datalist.length">
          <li 
            class="db" 
            v-for="(item, index) in datalist" 
            :key="index"
          >
            <div class="flexs">
              <div class="n">
                <div>{{ $t("page3.doc1") }}：{{ item.pendingAmount }} USDT</div>
                <div class="but" @click="navigateTo('/income/index')">
                  {{ $t("page3.doc2") }}
                </div>
              </div>
              <p class="n text-overflow">
                {{ $t("page3.doc3") }}：{{ item.levelName }}
              </p>
            </div>
            <div class="str">
              <div class="time">
                <div class="flex-center">
                  {{ $t("page3.doc89") }}:
                  <div v-if="item.sourceUserName">
                    {{ item.sourceUserName }} {{ $t("page3.doc90") }}
                  </div>
                  <div v-if="item.levelName">
                    {{ item.levelName }} {{ $t("page3.doc91") }}
                  </div>
                </div>
                <div>{{ $t("page3.doc4") }}：{{ item.expirationTime }}</div>
              </div>
            </div>
          </li>
        </ul>

        <div
          v-else
          class="empty db rel"
          style="z-index: 3"
        >
          <div class="flexs">
            <van-empty
              class="custom-image"
              :image="require('../../assets/images/none.png')"
              :description="$t('load.doc1')"
            />
          </div>
        </div>
      </div>
    </template>
  </page-scroll>
</template>

<script>
export default {
  data() {
    return {
      title: this.$t("title.doc44"),
      datalist: [],
    };
  },

  mounted() {
    this.fetchTeamInfo();
  },

  methods: {
    async fetchTeamInfo() {
      try {
        const res = await this.$post(this.URL.income.details, {});
        if (res.code === 0) {
          this.datalist = res.data.list;
        } else {
          this.$toast(res.message);
        }
      } catch (error) {
        console.error('获取团队信息失败:', error);
        this.$toast("Network error");
      }
    },

    navigateTo(url) {
      this.$router.push({ path: url });
    },
  },
};
</script>

<style lang="less" scoped>
.list {
  padding-top: 0.2rem;
  li {
    position: relative;
    padding-bottom: 0.32rem;
    margin-bottom: 0.32rem;
    background: #1f212c;
    padding: 0.2rem;
    border-radius: 0.12rem;
    display: flex;
    flex-direction: column;
    &:after {
      content: "";
      display: block;
      width: 100%;
      position: absolute;
      bottom: 0;
      left: 1.24rem;
      background: #202020;
      height: 0.02rem;
    }
    &:last-child {
      &:after {
        display: none;
      }
    }
    .ico {
      width: 0.92rem;
      margin-right: 0.32rem;
      img {
        height: 0.92rem;
        width: 100%;
        border-radius: 50%;
      }
      span {
        display: block;
        background: #f44343;
        color: #fff;
        padding: 0.02rem 0.04rem;
        right: -0.06rem;
        top: -0.06rem;
        font-size: 0.2rem;
        min-width: 0.3rem;
        height: 0.3rem;
        border-radius: 0.15rem;
        line-height: 0.26rem;
        text-align: center;
      }
    }
    .n {
      font-size: 0.3rem;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.9);
      line-height: 0.42rem;
      margin-bottom: 0.16rem;
      display: flex;
      justify-content: space-between;
    }
    p {
      font-size: 0.26rem;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.5);
      line-height: 0.36rem;
    }
    .time {
      font-size: 0.24rem;
      font-weight: 500;
      color: rgba(255, 255, 255, 0.5);
      line-height: 0.34rem;
      // margin-bottom: .34rem;
      display: flex;
      flex-direction: column;
      align-content: flex-start;
      span {
        width: 0.16rem;
        height: 0.16rem;
        border-radius: 50%;
        background: #f44343;
        display: block;
        margin-left: 0.12rem;
      }
    }
    .static {
      width: 0.18rem;
      height: 0.18rem;
      background: #f44343;
      border-radius: 50%;
      float: right;
    }
  }
}
.but {
  padding: 0rem 0.12rem;
  height: 0.6rem;
  text-align: center;
  line-height: 0.6rem;
  border-radius: 0.08rem;
  background: var(--backgroundLinear);
}
</style>
